//
//  CustomerModel.m
//  WGFGlobalHouses
//
//  Created by waiguofang on 15/5/22.
//  Copyright (c) 2015年 waiguofang. All rights reserved.
//

#import "CustomerModel.h"
#import "NSString+sizeWithFont.h"
#import "StringTool.h"
#import "API.h"
//#define ImgeForwardUrl2 @"http://files.wgfcdn.com/"

@implementation CustomerModel

-(instancetype)initWithDic:(NSDictionary *)dict;
{
    if (self = [super init]) {
        
        if ([StringTool isBlankString:dict[@"consumerAvatar"]]) {
            
            self.consumerAvatar = @"";
        }else{
            
            self.consumerAvatar = [API videoUrlMake:dict[@"consumerAvatar"]];
        }
       
        self.consumerId = [NSString stringWithFormat:@"%@",dict[@"consumerId"]];
        self.consumerMobile = dict[@"consumerMobile"];
        self.consumerName = dict[@"consumerName"];
        self.consumerCode = dict[@"consumerCode"];
        
        self.endTime = dict[@"endTime"];
        self.currentTime = dict[@"currentTime"];
        
        self.isSelected = false;
        
        self.consumerState = [NSString stringWithFormat:@"%@",dict[@"status"]];
        
        if (![StringTool isBlankString:self.endTime] && ![StringTool isBlankString:self.currentTime]) {
            
            self.dateNum = [NSString stringToDate:self.endTime withCurrentDate:self.currentTime];
        }
        
        self.isSelected = false;
    
        self.sex =[dict[@"sex"]integerValue];
        self.idCard = dict[@"idCard"];
        self.idCardType = [dict[@"idCardType"]integerValue];
        self.memo = dict[@"memo"];
      
    }
    return self;
}
+(instancetype)customerModelWithDic:(NSDictionary *)dict;
{
    return [[self alloc]initWithDic:dict];
}

@end
